package com.kidback.bbloc259.app.provider;

import com.google.gson.reflect.TypeToken;
import com.kidback.bbloc259.base.BaseProvider;
import com.kidback.bbloc259.bean.UserInfoBean;

import java.lang.reflect.Type;

public class UserDataProvider extends BaseProvider<UserInfoBean> {


    private static UserDataProvider instance = new UserDataProvider();

    public static UserDataProvider getInst() {
        return instance;
    }



    @Override
    protected Type getType() {
        return new TypeToken<UserInfoBean>() {
        }.getType();
    }

    @Override
    protected String getCacheKey() {
        return this.getClass().getName();
    }

    public boolean hasUserData() {
        return get() != null;
    }

    public String getUserId(){
        if (hasUserData()){
            return get().user_id;
        }

        return "";
    }

}
